package com.lizhanglong.core;

import android.os.AsyncTask;

/**
 * Created by mulong on 2017/11/14.
 */

public class AsyncTaskHelper extends AsyncTask {
    ITaskCallback taskCallback;

    public AsyncTaskHelper(ITaskCallback taskCallback) {
        this.taskCallback = taskCallback;
    }

    @Override
    protected Object doInBackground(Object[] params) {
        return taskCallback.Execute(params);
    }

    @Override
    protected void onPostExecute(Object result) {
        taskCallback.Complete(result);
    }


    public interface ITaskCallback {
        Object Execute(Object[] params);

        void Complete(Object result);
    }
}
